

cmake_minimum_required(VERSION 3.5)
project(c_application)

# 显式设置标准
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)

# 编译器选项
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
  add_compile_options(-Wall -Wextra -Wpedantic -std=c++17)
endif()

# 查找依赖
find_package(ament_cmake REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(nav2_waypoint_follower REQUIRED) 


# 可执行文件
add_executable(robot_test src/robot_test.cpp)
add_executable(multi_point src/multi_point.cpp)

ament_target_dependencies(robot_test
  nav2_msgs
  rclcpp
  rclcpp_action
  nav2_waypoint_follower
)

ament_target_dependencies(multi_point
  nav2_msgs
  rclcpp
  rclcpp_action
  nav2_waypoint_follower
)
# 安装
install(TARGETS robot_test
  DESTINATION lib/${PROJECT_NAME}
)
install(TARGETS multi_point
  DESTINATION lib/${PROJECT_NAME}
  )

# 导出依赖
ament_export_dependencies(
  nav2_msgs
  rclcpp
  rclcpp_action
  nav2_waypoint_follower
)

# 测试
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()